function [ F, usedsegs ] = parseword( word, y, window, S, F, usedsegs )
    for i=(window -1):(size(word,2)-1)
        sbeg = i - window + 2;
        send = i+1;
        seg = word(sbeg:send);
        
        j = S.(seg);
        tag = y(i:send);
        
        offset = 0;
        switch tag
            case '01'
                offset = 1;
            case '10'
                offset = 2;
            case '11'
                offset = 3;
        end
        
        usedsegs(j) = 1;
        j = j + offset*size(usedsegs,1);
        F(j) = F(j) + 1;
    end
end